from django.db import models

#Representa os exalunos da grandiosa
class ExAluno(models.Model):
	"""Representa os exalunos da grandiosa"""
	quadrinho = models.IntegerField(primary_key=True)
	apelido = models.CharField(max_length=50)
	anoFormacao = models.IntegerField()
	nome = models.CharField(max_length=50)
	telRes = models.CharField(max_length=50,null=True)
	celular = models.CharField(max_length=50,null=True)
	telCom = models.CharField(max_length=50,null=True)
	endereco = models.CharField(max_length=100)
	cep = models.CharField(max_length=10)
	cidade = models.CharField(max_length=50)
	estado = models.CharField(max_length=10)
	email = models.CharField(max_length=50,null=True)
	curso = models.CharField(max_length=50)
	aniversario = models.DateField(null=True)

	def __unicode__(self):
		return self.nome

	def __str__(self):
		return self.nome

#Representa os moradores da grandiosa		
class Morador(models.Model):
	"""Representa os moradores da grandiosa"""
	nome = models.CharField(max_length=50)
	apelido = models.CharField(max_length=50)
	rg = models.CharField(max_length=50,null=True)
	cpf = models.CharField(max_length=50,null=True)

	def __unicode__(self):
		return self.nome


#Representa as contas utilizadas no Doze 2014
class Conta(models.Model):
	"""Representa as contas utilizadas no Doze 2014"""
	titular = models.ForeignKey(Morador)
	banco = models.CharField(max_length=20)
	agencia = models.CharField(max_length=15)
	numConta = models.CharField(max_length=15)
	
	def __unicode__(self):
		return self.banco

#Representa os gastos do doze
class Gastos(models.Model):
	"""Representa os gastos do doze"""
	motivo = models.CharField(max_length=50)
	descricao = models.CharField(max_length=50)
	data = models.DateField()
	valor = models.FloatField();
	responsavel = models.ForeignKey(Morador)
	pago = models.BooleanField();

	def __unicode__(self):
		return self.descricao

#Depositos realizados pelos exalunos
class Deposito(models.Model):
	"""Depositos realizados pelos exalunos"""
	data = models.DateField()
	valor = models.FloatField()
	exaluno = models.ForeignKey(ExAluno)
	conta = models.ForeignKey(Conta)
	
	def __unicode__(self):
		return self.exaluno
# Create your models here.
